package my.design.test.interviewer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zp
 * @version 1.0
 * @description: 数据展示面板
 * @date 2022/10/22 16:09
 */
public class DataView {
    private final List<Computer> userList = new ArrayList<>();

    public DataView(){
        userList.add(new RootAccountComputer("谢⻜机"));
        userList.add(new OrdinaryAccountComputer("windy"));
    }

    // 展示
    public void show(Visitor visitor) {
        for (Computer computer : userList) {
            computer.accept(visitor);
        }
    }
    // 添加添加账户
    public void attach(Computer computer){
        userList.add(computer);
    }
    // 删除账户
    public void detach(Computer computer){
        userList.remove(computer);
    }
}
